package com.ruoyi.web.controller.trace;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.trace.domain.BusTraceMonitoringdata;
import com.ruoyi.trace.service.IBusTraceMonitoringdataService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 溯源仪-水质监测数据Controller
 * 
 * @author ruoyi
 * @date 2025-09-30
 */
@RestController
@RequestMapping("/trace/tracemonitoringdata")
public class BusTraceMonitoringdataController extends BaseController
{
    @Autowired
    private IBusTraceMonitoringdataService busTraceMonitoringdataService;

    /**
     * 查询溯源仪-水质监测数据列表
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracemonitoringdata:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusTraceMonitoringdata busTraceMonitoringdata)
    {
        startPage("sampletime desc");
        List<BusTraceMonitoringdata> list = busTraceMonitoringdataService.selectBusTraceMonitoringdataList(busTraceMonitoringdata);
        return getDataTable(list);
    }

    /**
     * 导出溯源仪-水质监测数据列表
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracemonitoringdata:export')")
    @Log(title = "溯源仪-水质监测数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusTraceMonitoringdata busTraceMonitoringdata)
    {
        List<BusTraceMonitoringdata> list = busTraceMonitoringdataService.selectBusTraceMonitoringdataList(busTraceMonitoringdata);
        ExcelUtil<BusTraceMonitoringdata> util = new ExcelUtil<BusTraceMonitoringdata>(BusTraceMonitoringdata.class);
        util.exportExcel(response, list, "溯源仪-水质监测数据数据");
    }

    /**
     * 获取溯源仪-水质监测数据详细信息
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracemonitoringdata:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busTraceMonitoringdataService.selectBusTraceMonitoringdataById(id));
    }

    /**
     * 新增溯源仪-水质监测数据
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracemonitoringdata:add')")
    @Log(title = "溯源仪-水质监测数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusTraceMonitoringdata busTraceMonitoringdata)
    {
        return toAjax(busTraceMonitoringdataService.insertBusTraceMonitoringdata(busTraceMonitoringdata));
    }

    /**
     * 修改溯源仪-水质监测数据
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracemonitoringdata:edit')")
    @Log(title = "溯源仪-水质监测数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusTraceMonitoringdata busTraceMonitoringdata)
    {
        return toAjax(busTraceMonitoringdataService.updateBusTraceMonitoringdata(busTraceMonitoringdata));
    }

    /**
     * 删除溯源仪-水质监测数据
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracemonitoringdata:remove')")
    @Log(title = "溯源仪-水质监测数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busTraceMonitoringdataService.deleteBusTraceMonitoringdataByIds(ids));
    }
}
